<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
            left: 0;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
<script>
    var box = document.querySelector('.box');
    let speed = 100;
    let left = 0;
    let timer = setInterval(() => {
        speed -= 12;
        left = left + speed;
        if(speed <= 0){
            clearInterval(timer)
        }
        box.style.left = left + 'px';
    },50)
</script>
</html>